/**  
 * Copyright © 2014公司名字. All rights reserved.
 *
 * @Title: UserController.java
 * @Prject: manpower
 * @Package: com.manpower.controller
 * @Description: TODO
 * @author: Administrator  
 * @date: 2014年8月19日 上午10:09:48
 * @version: V1.0  
 */
package com.manpower.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.manpower.model.MpUser;
import com.manpower.pageModel.User;
import com.manpower.service.MpUserService;

/**
 * @ClassName: UserController
 * @Description: TODO
 * @author: Administrator
 * @date: 2014年8月19日 上午10:09:48
 */
@Controller
@RequestMapping("userController")
public class UserController extends BaseController {
	@Autowired
	private MpUserService mpUserService;
	
	@ResponseBody
	@RequestMapping("/reg")
	public String regUser()
	{
		MpUser u=new MpUser();
		mpUserService.save(u);
		return "ok";
		
	}
	/**
	 * 登陆
	 * @Title: login
	 * @Description: TODO
	 * @param user
	 * @param session
	 * @return: String 
	 */
	@RequestMapping("/login")
	public String login(User user,HttpSession session){
		MpUser u= (MpUser) mpUserService.login(user);
		if (u!=null) {
			return "layout";
		}
		return "index";
	}
}
